package com.burry.bo;

import java.util.List;

public class JSONResult {
	public static final int RETCODE_OK = 0;
	public static final int RETCODE_ERR = -1;
	
	private int returnCode;
	private Object returnObj;
	private String errMessage;
	private int totalRecords;

	public int getTotalRecords() {
		totalRecords = ((List)returnObj).size();
		return totalRecords;
	}

	public void setTotalRecords(int totalRecords) {
		this.totalRecords = totalRecords;
	}

	public JSONResult() {
		this.returnCode = RETCODE_OK;
	}
	
	public JSONResult(Object returnObj) {
		this.returnCode = RETCODE_OK;
		this.returnObj = returnObj;
	}
	
	public JSONResult(String errMessage) {
		this.returnCode = RETCODE_ERR;
		this.errMessage = errMessage;
	}
	
	public void setReturnCode(int returnCode) {
		this.returnCode = returnCode;
	}

	public int getReturnCode() {
		return returnCode;
	}
	
	public void setReturnObj(Object returnObj) {
		this.returnObj = returnObj;
	}

	public Object getReturnObj() {
		return returnObj;
	}

	public void setErrMessage(String errMessage) {
		this.errMessage = errMessage;
	}

	public String getErrMessage() {
		return errMessage;
	}
}

